<?
require_once("../config/dbconn.php");require_once("../config/powercls.php");

if ($action=='reply'){
	$msg='';
	if(trim($reply)=='') $msg.="请输入回复内容\\n";
	if ($msg!=''){
		echo "<script>alert('$msg');history.back();</script>";exit();
	}
	
	//插入数据库
	$dataArray['reply']=addslashes($reply);
	$dataArray['replytime']=$curtime;
	
	$db->update("{$db_prefix}msgs",$dataArray,"id='$id'");
	
	echo "<script>alert('回复成功');location.href='msg_lst.php?pageno={$pageno}';</script>";exit();
}

	$sql="select * from {$db_prefix}msgs where id='$id'";
	$rs=$db->get_one($sql);

?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	
}
-->
</style>

<link href="images/skin.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.STYLE1 {color: #FF0000}
-->
</style>
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="17" height="29" valign="top" background="images/mail_leftbg.gif"><img src="images/left-top-right.gif" width="17" height="29" /></td>
    <td width="935" height="29" valign="top" background="images/content-bg.gif"><table width="100%" height="31" border="0" cellpadding="0" cellspacing="0" class="left_topbg" id="table2">
      <tr>
        <td height="31"><div class="titlebt">回复留言</div></td>
      </tr>
    </table></td>
    <td width="16" valign="top" background="images/mail_rightbg.gif"><img src="images/nav-right-bg.gif" width="16" height="29" /></td>
  </tr>
  <tr>
    <td height="71" valign="middle" background="images/mail_leftbg.gif">&nbsp;</td>
    <td valign="top" bgcolor="#F7F8F9"><table width="100%" height="138" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td height="13" valign="top">&nbsp;</td>
      </tr>
      <tr>
        <td valign="top">
		<form name="form1" method="post" action="?action=reply">
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td colspan="3"><table width="100%" height="31" border="0" cellpadding="0" cellspacing="0" class="nowtable">
                <tr>
                  <td class="left_bt2">&nbsp;&nbsp;&nbsp;&nbsp;</td>
                </tr>
              </table></td>
            </tr>
            <tr>
              <td height="30" colspan="3">
                <table width="100%" height="246" border="0" cellpadding="0" cellspacing="0">
                  <tr>
                    <td align="center" bgcolor="#FFFFFF" class="left_txt">留言会员</td>
                    <td height="30" bgcolor="#FFFFFF" class="left_txt"><?
					
					echo $rs['username'];
					?></td>
                  </tr>
                  <tr>
                    <td align="center" bgcolor="#FFFFFF" class="left_txt">时间</td>
                    <td height="30" bgcolor="#FFFFFF" class="left_txt"><?=date("Y-m-d H:i:s",$rs['addtime'])?></td>
                  </tr>
                  <tr>
                    <td align="center" bgcolor="#FFFFFF" class="left_txt">留言标题</td>
                    <td height="30" bgcolor="#FFFFFF" class="left_txt"><?=$rs['title']?>
                    </td>
                  </tr>
                  <tr>
                    <td align="center" bgcolor="#FFFFFF" class="left_txt">留言内容</td>
                    <td height="30" bgcolor="#FFFFFF" class="left_txt">&nbsp;</td>
                  </tr>
                  <tr>
                    <td height="36" colspan="2" align="left" bgcolor="#FFFFFF"><?=stripslashes($rs['content'])?></td>
                  </tr>
                  <tr>
                    <td height="30" align="center" bgcolor="#FFFFFF"><span class="STYLE1">回复时间</span></td>
                    <td height="30" align="left" bgcolor="#FFFFFF"><span class="STYLE1">
                      <?
				  if ($rs['replytime']>0) echo date('Y-m-d H:i:s',$rs['replytime'])."已回复";else echo "未回复";
				  ?>
                    </span></td>
                  </tr>
                  <tr>
                    <td height="30" align="center" bgcolor="#FFFFFF"><span class="STYLE1">
                      <label>回复内容</label>
                    </span></td>
                    <td height="30" align="left" bgcolor="#FFFFFF">&nbsp;</td>
                  </tr>
                  <tr>
                    <td height="30" colspan="2" align="left" bgcolor="#FFFFFF"><script charset="utf-8" src="../kindeditor/kindeditor-min.js"></script>
                        <script charset="utf-8" src="../kindeditor/lang/zh_CN.js"></script>
                        <script>
					KindEditor.ready(function(K) {
						K.create('#reply', {
							themeType : 'simple'
						});
					});
				  </script>
                        <textarea id="reply" name="reply" style="width:100%;height:200px;visibility:hidden;"><?=stripslashes($rs['reply'])?>
                  </textarea></td>
                  </tr>
                </table>
                          
              </td>
            </tr>
            
            <tr>
              <td height="30" colspan="3">&nbsp;</td>
            </tr>
            <tr>
              <td width="50%" height="30" align="right"><input name="pageno" type="hidden" id="pageno" value="<?=$pageno?>">
              <input name="id" type="hidden" id="id" value="<?=$id?>">
<input type="submit" value="确定回复" name="B1" /></td>
              <td width="6%" height="30" align="right">&nbsp;</td>
              <td width="44%" height="30">&nbsp;</td>
            </tr>
            <tr>
              <td height="30" colspan="3">&nbsp;</td>
            </tr>
          </table>
		   </form>
		  </td>
      </tr>
    </table></td>
    <td background="images/mail_rightbg.gif">&nbsp;</td>
  </tr>
  <tr>
    <td valign="middle" background="images/mail_leftbg.gif"><img src="images/buttom_left2.gif" width="17" height="17" /></td>
      <td height="17" valign="top" background="images/buttom_bgs.gif"><img src="images/buttom_bgs.gif" width="17" height="17" /></td>
    <td background="images/mail_rightbg.gif"><img src="images/buttom_right2.gif" width="16" height="17" /></td>
  </tr>
</table>

</body>
</html>